using System;

namespace GriffinNav.GPS
{
    public class Position
    {
        private Longitude mLongitude;
        private Latitude mLatitude;
        private Altitude mAltitude;

        internal int SatelliteCount = 0;
        internal FixQuality Fix = FixQuality.Invalid;
        internal DateTime FixTime;

        internal Position()
        {
            // set position objects
            mLongitude = new Longitude(0, 0.0M, LongitudeDirection.E);
            mLatitude = new Latitude(0, 0.0M, LatitudeDirection.N);
            mAltitude = new Altitude(0.0M);
        }

        internal Position(Longitude longitude, Latitude latitude)
        {
            // set position objects
            mLongitude = longitude;
            mLatitude = latitude;
            mAltitude = new Altitude(0.0M);
        }

        internal Position(Longitude longitude, Latitude latitude, Altitude altitude)
        {
            // set position objects
            mLongitude = longitude;
            mLatitude = latitude;
            mAltitude = altitude;
        }

        public Longitude Longitude
        {
            get
            {
                return mLongitude;
            }
        }

        public Latitude Latitude
        {
            get
            {
                return mLatitude;
            }
        }

        public Altitude Altitude
        {
            get
            {
                return mAltitude;
            }
        }

        public int Satellites
        {
            get
            {
                return SatelliteCount;
            }
        }

        public FixQuality FixQuality
        {
            get
            {
                return Fix;
            }
        }

        public DateTime FixDateTime
        {
            get
            {
                return FixTime;
            }
        }

        public string FixQualityString
        {
            get
            {
                switch (Fix)
                {
                    case FixQuality.GPS:
                        return "GPS Fix";
                    case FixQuality.DGPS:
                        return "Differential GPS Fix";
                    case FixQuality.Invalid:
                        return "No Fix";
                    case FixQuality.PPS:
                        return "PPS Fix";
                    default:
                        return "No Fix";
                }
            }
        }
    }
}
